<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>详细信息</title>
    <link href="./css/bootstrap.css" rel="stylesheet">
    <link href="./css/normalize.css" rel="stylesheet">
    <script src="./js/jquery.js"></script>
    <script src="./js/bootstrap.js"></script>
    <style>
        #hed{
            margin-top: 25px;
        }
    </style>
    <script>
        $(function (){
            let id = getQueryString("id");
            let params = {
                id:id
            }

            /**
             *  做 ajax 请求从后端获取数据
             */
            $.get("http://localhost:8080/customer/details",params,function (result){
                if (result.status === 200){
                    /*alert(result.status)
                    alert(result.data)*/
                    /**
                     *  数据回显
                     */
                    window.customer = result.data
                    $("#username").val(customer.cName)
                    $("#email").val(customer.email)
                    $("#cClassify").val(customer.cClassify)
                    $("#cSource").val(customer.cSource)
                    $("#cIndustry").val(customer.cInstury)
                    $("#cNetAddress").val(customer.cNetAddress)
                    $("#cContry").val(customer.cContry)
                    $("#cCity").val(customer.cCity)
                    $("#cLinkman").val(customer.cLinkman)
                    $("#cDepartment").val(customer.cDepartment)
                    $("#cPosition").val(customer.cPosition)
                    $("#cPhone").val(customer.cPhone)
                    $("#cLegalRepresent").val(customer.cLegalRepresent)
                    $("#cRegistredCapital").val(customer.cRegistredCapital)
                    $("#cInstruction").val(customer.cInstruction)
                    $("#bankCount").val(customer.bankAccount)
                    $("#acountName").val(customer.acountName)
                    $("#bank").val(customer.bank)
                    $("#bankAddress").val(customer.bankAddress)
                    $("#ein").val(customer.ein)
                    $("#bankPhone").val(customer.bankPhone)
                }
            })
        })
        function getQueryString(name) {
            let reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
            let r = window.location.search.substr(1).match(reg);
            return r != null ? unescape(r[2]) : null
        }
        $(function (){
            $("#reflesh").click(function (){
                window.location.href = "listPage.html"
            })
        })
    </script>
</head>
<body>
<div class="container">
    <div class="row">
        <div class="clearfix" id="hed" style="margin-bottom: 10px">
            <div class="pull-left">
                <p>
                    <span style="font-size: 16px;font-weight: bold">客户详情</span>
                </p>
            </div>
            <div class="pull-right">
                <button class="btn-info" id="reflesh">返回展示首页</button>
            </div>
        </div>
        <div style="background: #a6e1ec;border: solid 1px #bdb0b0;margin-bottom: 10px">
            <P>
                <span>基本信息</span>
            </P>
        </div>
        <div class="clearfix" style="margin-bottom: 10px">
            <div class="pull-left">
                <span>客户名称</span>
                <input id="username" type="text" name="username">
            </div>
            <div class="pull-right">
                <span>邮件/QQ</span>
                <input id="email" type="text" name="email">
            </div>
        </div>
        <div class="clearfix" style="margin-bottom: 10px">
            <div class="pull-left">
                <span>分类</span>
                <input id="cClassify" type="text" name="cClassify">
            </div>
            <div class="pull-right">
                <span>客户来源</span>
                <input id="cSource" type="text" name="clientSource">
            </div>
        </div>
        <div class="clearfix" style="margin-bottom: 10px">
            <div class="pull-left">
                <span>所属行业</span>
                <input id="cIndustry" type="text" name="clientInstury">
            </div>
            <div class="pull-right">
                <span>客户网址</span>
                <input id="cNetAddress" type="text" name="clientNetAddress">
            </div>
        </div>
        <div class="clearfix" style="margin-bottom: 10px">
            <div class="pull-left">
                <span>国家/地区</span>
                <input id="cContry" type="text" name="clientContry">
            </div>
            <div class="pull-right">
                <span>所在城市</span>
                <input id="cCity" type="text" name="clientCity">
            </div>
        </div>

        <div class="clearfix" style="margin-bottom: 10px">
            <div class="pull-left">
                <span>联系人</span>
                <input id="cLinkman" type="text" name="clientLinkman">
            </div>
            <div class="pull-right">
                <span>部门</span>
                <input id="cDepartment" type="text" name="clientDepartment">
            </div>
        </div>
        <div class="clearfix" style="margin-bottom: 10px">
            <div class="pull-left">
                <span>职务</span>
                <input id="cPosition" type="text" name="clientPosition">
            </div>
            <div class="pull-right">
                <span>移动电话</span>
                <input id="cPhone" type="text" name="clientPhone">
            </div>
        </div>
        <div class="clearfix" style="margin-bottom: 10px">
            <div class="pull-left">
                <span>法人代表</span>
                <input id="cLegalRepresent" type="text" name="clientLegalRepresent">
            </div>
            <div class="pull-right">
                <span>注册资本</span>
                <input id="cRegistredCapital" type="text" name="clientRegistredCapital">
            </div>
        </div>
        <div  style="margin-bottom: 30px">
            <span>附加说明</span>
            <input id="cInstruction" type="text" class="form-control input-large" name="clientInstruction">
        </div>

        <div style="background: #a6e1ec;border: solid 1px #bdb0b0;margin-bottom: 10px">
            <P>
                <span>财务信息</span>
            </P>
        </div>

        <div class="clearfix" style="margin-bottom: 10px">
            <div class="pull-left">
                <span>银行账号</span>
                <input id="bankCount" type="text" name="bankAccount">
            </div>
            <div class="pull-right">
                <span>开户名称</span>
                <input id="acountName" type="text" name="acountName">
            </div>
        </div>
        <div class="clearfix" style="margin-bottom: 10px">
            <div class="pull-left">
                <span>开户银行</span>
                <input id="bank" type="text" name="bank">
            </div>
            <div class="pull-right">
                <span>银行地址</span>
                <input id="bankAddress" type="text" name="bankAddress">
            </div>
        </div>
        <div class="clearfix" style="margin-bottom: 10px">
            <div class="pull-left">
                <span>税号</span>
                <input id="ein" type="text" name="ein">
            </div>
            <div class="pull-right">
                <span>电话</span>
                <input id="bankPhone" type="text" name="bankPhone">
            </div>
        </div>

    </div>
</div>
</body>
</html>